package Polymorphism.Exer2;

/**
 * @author Jimmy
 * @date 2022/11/15 - 14:45
 */
public class GeometricTest {
    public static void main(String[] args) {
        GeometricTest test = new GeometricTest();
        test.equalsArea(new Circle(1, "Blue", 10), new MyRectangle(1, Math.PI, "Red", 2));
    }

    public void equalsArea(GeometricObject g1, GeometricObject g2){
        System.out.println("g1 area: " + displayGeometricObject(g1));
        System.out.println("g2 area: " + displayGeometricObject(g2));
        if (g1.findArea() == g2.findArea()){
            System.out.println("Equals.");
        } else {
            System.out.println("Not Equals.");
        }
    }

    public double displayGeometricObject(GeometricObject g){
        return g.findArea();
    }
}
